/*
 * Copyright 2019 Ververica GmbH.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: src/main/protobuf/stateful-functions.proto

package com.ververica.statefun.flink.core.generated;

/** Protobuf type {@code com.ververica.statefun.flink.core.Envelope} */
public final class Envelope extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:com.ververica.statefun.flink.core.Envelope)
    EnvelopeOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use Envelope.newBuilder() to construct.
  private Envelope(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private Envelope() {}

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
    return this.unknownFields;
  }

  private Envelope(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    if (extensionRegistry == null) {
      throw new java.lang.NullPointerException();
    }
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          case 10:
            {
              com.ververica.statefun.flink.core.generated.EnvelopeAddress.Builder subBuilder = null;
              if (source_ != null) {
                subBuilder = source_.toBuilder();
              }
              source_ =
                  input.readMessage(
                      com.ververica.statefun.flink.core.generated.EnvelopeAddress.parser(),
                      extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(source_);
                source_ = subBuilder.buildPartial();
              }

              break;
            }
          case 18:
            {
              com.ververica.statefun.flink.core.generated.EnvelopeAddress.Builder subBuilder = null;
              if (target_ != null) {
                subBuilder = target_.toBuilder();
              }
              target_ =
                  input.readMessage(
                      com.ververica.statefun.flink.core.generated.EnvelopeAddress.parser(),
                      extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(target_);
                target_ = subBuilder.buildPartial();
              }

              break;
            }
          case 26:
            {
              com.ververica.statefun.flink.core.generated.Payload.Builder subBuilder = null;
              if (bodyCase_ == 3) {
                subBuilder =
                    ((com.ververica.statefun.flink.core.generated.Payload) body_).toBuilder();
              }
              body_ =
                  input.readMessage(
                      com.ververica.statefun.flink.core.generated.Payload.parser(),
                      extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom((com.ververica.statefun.flink.core.generated.Payload) body_);
                body_ = subBuilder.buildPartial();
              }
              bodyCase_ = 3;
              break;
            }
          case 34:
            {
              com.ververica.statefun.flink.core.generated.Checkpoint.Builder subBuilder = null;
              if (bodyCase_ == 4) {
                subBuilder =
                    ((com.ververica.statefun.flink.core.generated.Checkpoint) body_).toBuilder();
              }
              body_ =
                  input.readMessage(
                      com.ververica.statefun.flink.core.generated.Checkpoint.parser(),
                      extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(
                    (com.ververica.statefun.flink.core.generated.Checkpoint) body_);
                body_ = subBuilder.buildPartial();
              }
              bodyCase_ = 4;
              break;
            }
          default:
            {
              if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
    } finally {
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.ververica.statefun.flink.core.generated.StatefulFunctions
        .internal_static_com_ververica_statefun_flink_core_Envelope_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.ververica.statefun.flink.core.generated.StatefulFunctions
        .internal_static_com_ververica_statefun_flink_core_Envelope_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.ververica.statefun.flink.core.generated.Envelope.class,
            com.ververica.statefun.flink.core.generated.Envelope.Builder.class);
  }

  private int bodyCase_ = 0;
  private java.lang.Object body_;

  public enum BodyCase implements com.google.protobuf.Internal.EnumLite {
    CHECKPOINT(4),
    PAYLOAD(3),
    BODY_NOT_SET(0);
    private final int value;

    private BodyCase(int value) {
      this.value = value;
    }
    /** @deprecated Use {@link #forNumber(int)} instead. */
    @java.lang.Deprecated
    public static BodyCase valueOf(int value) {
      return forNumber(value);
    }

    public static BodyCase forNumber(int value) {
      switch (value) {
        case 4:
          return CHECKPOINT;
        case 3:
          return PAYLOAD;
        case 0:
          return BODY_NOT_SET;
        default:
          return null;
      }
    }

    public int getNumber() {
      return this.value;
    }
  };

  public BodyCase getBodyCase() {
    return BodyCase.forNumber(bodyCase_);
  }

  public static final int SOURCE_FIELD_NUMBER = 1;
  private com.ververica.statefun.flink.core.generated.EnvelopeAddress source_;
  /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress source = 1;</code> */
  public boolean hasSource() {
    return source_ != null;
  }
  /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress source = 1;</code> */
  public com.ververica.statefun.flink.core.generated.EnvelopeAddress getSource() {
    return source_ == null
        ? com.ververica.statefun.flink.core.generated.EnvelopeAddress.getDefaultInstance()
        : source_;
  }
  /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress source = 1;</code> */
  public com.ververica.statefun.flink.core.generated.EnvelopeAddressOrBuilder getSourceOrBuilder() {
    return getSource();
  }

  public static final int TARGET_FIELD_NUMBER = 2;
  private com.ververica.statefun.flink.core.generated.EnvelopeAddress target_;
  /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress target = 2;</code> */
  public boolean hasTarget() {
    return target_ != null;
  }
  /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress target = 2;</code> */
  public com.ververica.statefun.flink.core.generated.EnvelopeAddress getTarget() {
    return target_ == null
        ? com.ververica.statefun.flink.core.generated.EnvelopeAddress.getDefaultInstance()
        : target_;
  }
  /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress target = 2;</code> */
  public com.ververica.statefun.flink.core.generated.EnvelopeAddressOrBuilder getTargetOrBuilder() {
    return getTarget();
  }

  public static final int CHECKPOINT_FIELD_NUMBER = 4;
  /** <code>.com.ververica.statefun.flink.core.Checkpoint checkpoint = 4;</code> */
  public boolean hasCheckpoint() {
    return bodyCase_ == 4;
  }
  /** <code>.com.ververica.statefun.flink.core.Checkpoint checkpoint = 4;</code> */
  public com.ververica.statefun.flink.core.generated.Checkpoint getCheckpoint() {
    if (bodyCase_ == 4) {
      return (com.ververica.statefun.flink.core.generated.Checkpoint) body_;
    }
    return com.ververica.statefun.flink.core.generated.Checkpoint.getDefaultInstance();
  }
  /** <code>.com.ververica.statefun.flink.core.Checkpoint checkpoint = 4;</code> */
  public com.ververica.statefun.flink.core.generated.CheckpointOrBuilder getCheckpointOrBuilder() {
    if (bodyCase_ == 4) {
      return (com.ververica.statefun.flink.core.generated.Checkpoint) body_;
    }
    return com.ververica.statefun.flink.core.generated.Checkpoint.getDefaultInstance();
  }

  public static final int PAYLOAD_FIELD_NUMBER = 3;
  /** <code>.com.ververica.statefun.flink.core.Payload payload = 3;</code> */
  public boolean hasPayload() {
    return bodyCase_ == 3;
  }
  /** <code>.com.ververica.statefun.flink.core.Payload payload = 3;</code> */
  public com.ververica.statefun.flink.core.generated.Payload getPayload() {
    if (bodyCase_ == 3) {
      return (com.ververica.statefun.flink.core.generated.Payload) body_;
    }
    return com.ververica.statefun.flink.core.generated.Payload.getDefaultInstance();
  }
  /** <code>.com.ververica.statefun.flink.core.Payload payload = 3;</code> */
  public com.ververica.statefun.flink.core.generated.PayloadOrBuilder getPayloadOrBuilder() {
    if (bodyCase_ == 3) {
      return (com.ververica.statefun.flink.core.generated.Payload) body_;
    }
    return com.ververica.statefun.flink.core.generated.Payload.getDefaultInstance();
  }

  private byte memoizedIsInitialized = -1;

  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (source_ != null) {
      output.writeMessage(1, getSource());
    }
    if (target_ != null) {
      output.writeMessage(2, getTarget());
    }
    if (bodyCase_ == 3) {
      output.writeMessage(3, (com.ververica.statefun.flink.core.generated.Payload) body_);
    }
    if (bodyCase_ == 4) {
      output.writeMessage(4, (com.ververica.statefun.flink.core.generated.Checkpoint) body_);
    }
    unknownFields.writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (source_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getSource());
    }
    if (target_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getTarget());
    }
    if (bodyCase_ == 3) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(
              3, (com.ververica.statefun.flink.core.generated.Payload) body_);
    }
    if (bodyCase_ == 4) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(
              4, (com.ververica.statefun.flink.core.generated.Checkpoint) body_);
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.ververica.statefun.flink.core.generated.Envelope)) {
      return super.equals(obj);
    }
    com.ververica.statefun.flink.core.generated.Envelope other =
        (com.ververica.statefun.flink.core.generated.Envelope) obj;

    if (hasSource() != other.hasSource()) return false;
    if (hasSource()) {
      if (!getSource().equals(other.getSource())) return false;
    }
    if (hasTarget() != other.hasTarget()) return false;
    if (hasTarget()) {
      if (!getTarget().equals(other.getTarget())) return false;
    }
    if (!getBodyCase().equals(other.getBodyCase())) return false;
    switch (bodyCase_) {
      case 4:
        if (!getCheckpoint().equals(other.getCheckpoint())) return false;
        break;
      case 3:
        if (!getPayload().equals(other.getPayload())) return false;
        break;
      case 0:
      default:
    }
    if (!unknownFields.equals(other.unknownFields)) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    if (hasSource()) {
      hash = (37 * hash) + SOURCE_FIELD_NUMBER;
      hash = (53 * hash) + getSource().hashCode();
    }
    if (hasTarget()) {
      hash = (37 * hash) + TARGET_FIELD_NUMBER;
      hash = (53 * hash) + getTarget().hashCode();
    }
    switch (bodyCase_) {
      case 4:
        hash = (37 * hash) + CHECKPOINT_FIELD_NUMBER;
        hash = (53 * hash) + getCheckpoint().hashCode();
        break;
      case 3:
        hash = (37 * hash) + PAYLOAD_FIELD_NUMBER;
        hash = (53 * hash) + getPayload().hashCode();
        break;
      case 0:
      default:
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.ververica.statefun.flink.core.generated.Envelope parseFrom(
      java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.ververica.statefun.flink.core.generated.Envelope parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.ververica.statefun.flink.core.generated.Envelope parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.ververica.statefun.flink.core.generated.Envelope parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.ververica.statefun.flink.core.generated.Envelope parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.ververica.statefun.flink.core.generated.Envelope parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.ververica.statefun.flink.core.generated.Envelope parseFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.ververica.statefun.flink.core.generated.Envelope parseFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.ververica.statefun.flink.core.generated.Envelope parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.ververica.statefun.flink.core.generated.Envelope parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.ververica.statefun.flink.core.generated.Envelope parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.ververica.statefun.flink.core.generated.Envelope parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() {
    return newBuilder();
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(com.ververica.statefun.flink.core.generated.Envelope prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /** Protobuf type {@code com.ververica.statefun.flink.core.Envelope} */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:com.ververica.statefun.flink.core.Envelope)
      com.ververica.statefun.flink.core.generated.EnvelopeOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.ververica.statefun.flink.core.generated.StatefulFunctions
          .internal_static_com_ververica_statefun_flink_core_Envelope_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.ververica.statefun.flink.core.generated.StatefulFunctions
          .internal_static_com_ververica_statefun_flink_core_Envelope_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.ververica.statefun.flink.core.generated.Envelope.class,
              com.ververica.statefun.flink.core.generated.Envelope.Builder.class);
    }

    // Construct using com.ververica.statefun.flink.core.generated.Envelope.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }

    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {}
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      if (sourceBuilder_ == null) {
        source_ = null;
      } else {
        source_ = null;
        sourceBuilder_ = null;
      }
      if (targetBuilder_ == null) {
        target_ = null;
      } else {
        target_ = null;
        targetBuilder_ = null;
      }
      bodyCase_ = 0;
      body_ = null;
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.ververica.statefun.flink.core.generated.StatefulFunctions
          .internal_static_com_ververica_statefun_flink_core_Envelope_descriptor;
    }

    @java.lang.Override
    public com.ververica.statefun.flink.core.generated.Envelope getDefaultInstanceForType() {
      return com.ververica.statefun.flink.core.generated.Envelope.getDefaultInstance();
    }

    @java.lang.Override
    public com.ververica.statefun.flink.core.generated.Envelope build() {
      com.ververica.statefun.flink.core.generated.Envelope result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.ververica.statefun.flink.core.generated.Envelope buildPartial() {
      com.ververica.statefun.flink.core.generated.Envelope result =
          new com.ververica.statefun.flink.core.generated.Envelope(this);
      if (sourceBuilder_ == null) {
        result.source_ = source_;
      } else {
        result.source_ = sourceBuilder_.build();
      }
      if (targetBuilder_ == null) {
        result.target_ = target_;
      } else {
        result.target_ = targetBuilder_.build();
      }
      if (bodyCase_ == 4) {
        if (checkpointBuilder_ == null) {
          result.body_ = body_;
        } else {
          result.body_ = checkpointBuilder_.build();
        }
      }
      if (bodyCase_ == 3) {
        if (payloadBuilder_ == null) {
          result.body_ = body_;
        } else {
          result.body_ = payloadBuilder_.build();
        }
      }
      result.bodyCase_ = bodyCase_;
      onBuilt();
      return result;
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }

    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.setField(field, value);
    }

    @java.lang.Override
    public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }

    @java.lang.Override
    public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }

    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }

    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.ververica.statefun.flink.core.generated.Envelope) {
        return mergeFrom((com.ververica.statefun.flink.core.generated.Envelope) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.ververica.statefun.flink.core.generated.Envelope other) {
      if (other == com.ververica.statefun.flink.core.generated.Envelope.getDefaultInstance())
        return this;
      if (other.hasSource()) {
        mergeSource(other.getSource());
      }
      if (other.hasTarget()) {
        mergeTarget(other.getTarget());
      }
      switch (other.getBodyCase()) {
        case CHECKPOINT:
          {
            mergeCheckpoint(other.getCheckpoint());
            break;
          }
        case PAYLOAD:
          {
            mergePayload(other.getPayload());
            break;
          }
        case BODY_NOT_SET:
          {
            break;
          }
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.ververica.statefun.flink.core.generated.Envelope parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage =
            (com.ververica.statefun.flink.core.generated.Envelope) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

    private int bodyCase_ = 0;
    private java.lang.Object body_;

    public BodyCase getBodyCase() {
      return BodyCase.forNumber(bodyCase_);
    }

    public Builder clearBody() {
      bodyCase_ = 0;
      body_ = null;
      onChanged();
      return this;
    }

    private com.ververica.statefun.flink.core.generated.EnvelopeAddress source_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.ververica.statefun.flink.core.generated.EnvelopeAddress,
            com.ververica.statefun.flink.core.generated.EnvelopeAddress.Builder,
            com.ververica.statefun.flink.core.generated.EnvelopeAddressOrBuilder>
        sourceBuilder_;
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress source = 1;</code> */
    public boolean hasSource() {
      return sourceBuilder_ != null || source_ != null;
    }
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress source = 1;</code> */
    public com.ververica.statefun.flink.core.generated.EnvelopeAddress getSource() {
      if (sourceBuilder_ == null) {
        return source_ == null
            ? com.ververica.statefun.flink.core.generated.EnvelopeAddress.getDefaultInstance()
            : source_;
      } else {
        return sourceBuilder_.getMessage();
      }
    }
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress source = 1;</code> */
    public Builder setSource(com.ververica.statefun.flink.core.generated.EnvelopeAddress value) {
      if (sourceBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        source_ = value;
        onChanged();
      } else {
        sourceBuilder_.setMessage(value);
      }

      return this;
    }
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress source = 1;</code> */
    public Builder setSource(
        com.ververica.statefun.flink.core.generated.EnvelopeAddress.Builder builderForValue) {
      if (sourceBuilder_ == null) {
        source_ = builderForValue.build();
        onChanged();
      } else {
        sourceBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress source = 1;</code> */
    public Builder mergeSource(com.ververica.statefun.flink.core.generated.EnvelopeAddress value) {
      if (sourceBuilder_ == null) {
        if (source_ != null) {
          source_ =
              com.ververica.statefun.flink.core.generated.EnvelopeAddress.newBuilder(source_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          source_ = value;
        }
        onChanged();
      } else {
        sourceBuilder_.mergeFrom(value);
      }

      return this;
    }
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress source = 1;</code> */
    public Builder clearSource() {
      if (sourceBuilder_ == null) {
        source_ = null;
        onChanged();
      } else {
        source_ = null;
        sourceBuilder_ = null;
      }

      return this;
    }
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress source = 1;</code> */
    public com.ververica.statefun.flink.core.generated.EnvelopeAddress.Builder getSourceBuilder() {

      onChanged();
      return getSourceFieldBuilder().getBuilder();
    }
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress source = 1;</code> */
    public com.ververica.statefun.flink.core.generated.EnvelopeAddressOrBuilder
        getSourceOrBuilder() {
      if (sourceBuilder_ != null) {
        return sourceBuilder_.getMessageOrBuilder();
      } else {
        return source_ == null
            ? com.ververica.statefun.flink.core.generated.EnvelopeAddress.getDefaultInstance()
            : source_;
      }
    }
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress source = 1;</code> */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.ververica.statefun.flink.core.generated.EnvelopeAddress,
            com.ververica.statefun.flink.core.generated.EnvelopeAddress.Builder,
            com.ververica.statefun.flink.core.generated.EnvelopeAddressOrBuilder>
        getSourceFieldBuilder() {
      if (sourceBuilder_ == null) {
        sourceBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.ververica.statefun.flink.core.generated.EnvelopeAddress,
                com.ververica.statefun.flink.core.generated.EnvelopeAddress.Builder,
                com.ververica.statefun.flink.core.generated.EnvelopeAddressOrBuilder>(
                getSource(), getParentForChildren(), isClean());
        source_ = null;
      }
      return sourceBuilder_;
    }

    private com.ververica.statefun.flink.core.generated.EnvelopeAddress target_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.ververica.statefun.flink.core.generated.EnvelopeAddress,
            com.ververica.statefun.flink.core.generated.EnvelopeAddress.Builder,
            com.ververica.statefun.flink.core.generated.EnvelopeAddressOrBuilder>
        targetBuilder_;
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress target = 2;</code> */
    public boolean hasTarget() {
      return targetBuilder_ != null || target_ != null;
    }
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress target = 2;</code> */
    public com.ververica.statefun.flink.core.generated.EnvelopeAddress getTarget() {
      if (targetBuilder_ == null) {
        return target_ == null
            ? com.ververica.statefun.flink.core.generated.EnvelopeAddress.getDefaultInstance()
            : target_;
      } else {
        return targetBuilder_.getMessage();
      }
    }
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress target = 2;</code> */
    public Builder setTarget(com.ververica.statefun.flink.core.generated.EnvelopeAddress value) {
      if (targetBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        target_ = value;
        onChanged();
      } else {
        targetBuilder_.setMessage(value);
      }

      return this;
    }
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress target = 2;</code> */
    public Builder setTarget(
        com.ververica.statefun.flink.core.generated.EnvelopeAddress.Builder builderForValue) {
      if (targetBuilder_ == null) {
        target_ = builderForValue.build();
        onChanged();
      } else {
        targetBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress target = 2;</code> */
    public Builder mergeTarget(com.ververica.statefun.flink.core.generated.EnvelopeAddress value) {
      if (targetBuilder_ == null) {
        if (target_ != null) {
          target_ =
              com.ververica.statefun.flink.core.generated.EnvelopeAddress.newBuilder(target_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          target_ = value;
        }
        onChanged();
      } else {
        targetBuilder_.mergeFrom(value);
      }

      return this;
    }
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress target = 2;</code> */
    public Builder clearTarget() {
      if (targetBuilder_ == null) {
        target_ = null;
        onChanged();
      } else {
        target_ = null;
        targetBuilder_ = null;
      }

      return this;
    }
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress target = 2;</code> */
    public com.ververica.statefun.flink.core.generated.EnvelopeAddress.Builder getTargetBuilder() {

      onChanged();
      return getTargetFieldBuilder().getBuilder();
    }
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress target = 2;</code> */
    public com.ververica.statefun.flink.core.generated.EnvelopeAddressOrBuilder
        getTargetOrBuilder() {
      if (targetBuilder_ != null) {
        return targetBuilder_.getMessageOrBuilder();
      } else {
        return target_ == null
            ? com.ververica.statefun.flink.core.generated.EnvelopeAddress.getDefaultInstance()
            : target_;
      }
    }
    /** <code>.com.ververica.statefun.flink.core.EnvelopeAddress target = 2;</code> */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.ververica.statefun.flink.core.generated.EnvelopeAddress,
            com.ververica.statefun.flink.core.generated.EnvelopeAddress.Builder,
            com.ververica.statefun.flink.core.generated.EnvelopeAddressOrBuilder>
        getTargetFieldBuilder() {
      if (targetBuilder_ == null) {
        targetBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.ververica.statefun.flink.core.generated.EnvelopeAddress,
                com.ververica.statefun.flink.core.generated.EnvelopeAddress.Builder,
                com.ververica.statefun.flink.core.generated.EnvelopeAddressOrBuilder>(
                getTarget(), getParentForChildren(), isClean());
        target_ = null;
      }
      return targetBuilder_;
    }

    private com.google.protobuf.SingleFieldBuilderV3<
            com.ververica.statefun.flink.core.generated.Checkpoint,
            com.ververica.statefun.flink.core.generated.Checkpoint.Builder,
            com.ververica.statefun.flink.core.generated.CheckpointOrBuilder>
        checkpointBuilder_;
    /** <code>.com.ververica.statefun.flink.core.Checkpoint checkpoint = 4;</code> */
    public boolean hasCheckpoint() {
      return bodyCase_ == 4;
    }
    /** <code>.com.ververica.statefun.flink.core.Checkpoint checkpoint = 4;</code> */
    public com.ververica.statefun.flink.core.generated.Checkpoint getCheckpoint() {
      if (checkpointBuilder_ == null) {
        if (bodyCase_ == 4) {
          return (com.ververica.statefun.flink.core.generated.Checkpoint) body_;
        }
        return com.ververica.statefun.flink.core.generated.Checkpoint.getDefaultInstance();
      } else {
        if (bodyCase_ == 4) {
          return checkpointBuilder_.getMessage();
        }
        return com.ververica.statefun.flink.core.generated.Checkpoint.getDefaultInstance();
      }
    }
    /** <code>.com.ververica.statefun.flink.core.Checkpoint checkpoint = 4;</code> */
    public Builder setCheckpoint(com.ververica.statefun.flink.core.generated.Checkpoint value) {
      if (checkpointBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        body_ = value;
        onChanged();
      } else {
        checkpointBuilder_.setMessage(value);
      }
      bodyCase_ = 4;
      return this;
    }
    /** <code>.com.ververica.statefun.flink.core.Checkpoint checkpoint = 4;</code> */
    public Builder setCheckpoint(
        com.ververica.statefun.flink.core.generated.Checkpoint.Builder builderForValue) {
      if (checkpointBuilder_ == null) {
        body_ = builderForValue.build();
        onChanged();
      } else {
        checkpointBuilder_.setMessage(builderForValue.build());
      }
      bodyCase_ = 4;
      return this;
    }
    /** <code>.com.ververica.statefun.flink.core.Checkpoint checkpoint = 4;</code> */
    public Builder mergeCheckpoint(com.ververica.statefun.flink.core.generated.Checkpoint value) {
      if (checkpointBuilder_ == null) {
        if (bodyCase_ == 4
            && body_
                != com.ververica.statefun.flink.core.generated.Checkpoint.getDefaultInstance()) {
          body_ =
              com.ververica.statefun.flink.core.generated.Checkpoint.newBuilder(
                      (com.ververica.statefun.flink.core.generated.Checkpoint) body_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          body_ = value;
        }
        onChanged();
      } else {
        if (bodyCase_ == 4) {
          checkpointBuilder_.mergeFrom(value);
        }
        checkpointBuilder_.setMessage(value);
      }
      bodyCase_ = 4;
      return this;
    }
    /** <code>.com.ververica.statefun.flink.core.Checkpoint checkpoint = 4;</code> */
    public Builder clearCheckpoint() {
      if (checkpointBuilder_ == null) {
        if (bodyCase_ == 4) {
          bodyCase_ = 0;
          body_ = null;
          onChanged();
        }
      } else {
        if (bodyCase_ == 4) {
          bodyCase_ = 0;
          body_ = null;
        }
        checkpointBuilder_.clear();
      }
      return this;
    }
    /** <code>.com.ververica.statefun.flink.core.Checkpoint checkpoint = 4;</code> */
    public com.ververica.statefun.flink.core.generated.Checkpoint.Builder getCheckpointBuilder() {
      return getCheckpointFieldBuilder().getBuilder();
    }
    /** <code>.com.ververica.statefun.flink.core.Checkpoint checkpoint = 4;</code> */
    public com.ververica.statefun.flink.core.generated.CheckpointOrBuilder
        getCheckpointOrBuilder() {
      if ((bodyCase_ == 4) && (checkpointBuilder_ != null)) {
        return checkpointBuilder_.getMessageOrBuilder();
      } else {
        if (bodyCase_ == 4) {
          return (com.ververica.statefun.flink.core.generated.Checkpoint) body_;
        }
        return com.ververica.statefun.flink.core.generated.Checkpoint.getDefaultInstance();
      }
    }
    /** <code>.com.ververica.statefun.flink.core.Checkpoint checkpoint = 4;</code> */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.ververica.statefun.flink.core.generated.Checkpoint,
            com.ververica.statefun.flink.core.generated.Checkpoint.Builder,
            com.ververica.statefun.flink.core.generated.CheckpointOrBuilder>
        getCheckpointFieldBuilder() {
      if (checkpointBuilder_ == null) {
        if (!(bodyCase_ == 4)) {
          body_ = com.ververica.statefun.flink.core.generated.Checkpoint.getDefaultInstance();
        }
        checkpointBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.ververica.statefun.flink.core.generated.Checkpoint,
                com.ververica.statefun.flink.core.generated.Checkpoint.Builder,
                com.ververica.statefun.flink.core.generated.CheckpointOrBuilder>(
                (com.ververica.statefun.flink.core.generated.Checkpoint) body_,
                getParentForChildren(),
                isClean());
        body_ = null;
      }
      bodyCase_ = 4;
      onChanged();
      ;
      return checkpointBuilder_;
    }

    private com.google.protobuf.SingleFieldBuilderV3<
            com.ververica.statefun.flink.core.generated.Payload,
            com.ververica.statefun.flink.core.generated.Payload.Builder,
            com.ververica.statefun.flink.core.generated.PayloadOrBuilder>
        payloadBuilder_;
    /** <code>.com.ververica.statefun.flink.core.Payload payload = 3;</code> */
    public boolean hasPayload() {
      return bodyCase_ == 3;
    }
    /** <code>.com.ververica.statefun.flink.core.Payload payload = 3;</code> */
    public com.ververica.statefun.flink.core.generated.Payload getPayload() {
      if (payloadBuilder_ == null) {
        if (bodyCase_ == 3) {
          return (com.ververica.statefun.flink.core.generated.Payload) body_;
        }
        return com.ververica.statefun.flink.core.generated.Payload.getDefaultInstance();
      } else {
        if (bodyCase_ == 3) {
          return payloadBuilder_.getMessage();
        }
        return com.ververica.statefun.flink.core.generated.Payload.getDefaultInstance();
      }
    }
    /** <code>.com.ververica.statefun.flink.core.Payload payload = 3;</code> */
    public Builder setPayload(com.ververica.statefun.flink.core.generated.Payload value) {
      if (payloadBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        body_ = value;
        onChanged();
      } else {
        payloadBuilder_.setMessage(value);
      }
      bodyCase_ = 3;
      return this;
    }
    /** <code>.com.ververica.statefun.flink.core.Payload payload = 3;</code> */
    public Builder setPayload(
        com.ververica.statefun.flink.core.generated.Payload.Builder builderForValue) {
      if (payloadBuilder_ == null) {
        body_ = builderForValue.build();
        onChanged();
      } else {
        payloadBuilder_.setMessage(builderForValue.build());
      }
      bodyCase_ = 3;
      return this;
    }
    /** <code>.com.ververica.statefun.flink.core.Payload payload = 3;</code> */
    public Builder mergePayload(com.ververica.statefun.flink.core.generated.Payload value) {
      if (payloadBuilder_ == null) {
        if (bodyCase_ == 3
            && body_ != com.ververica.statefun.flink.core.generated.Payload.getDefaultInstance()) {
          body_ =
              com.ververica.statefun.flink.core.generated.Payload.newBuilder(
                      (com.ververica.statefun.flink.core.generated.Payload) body_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          body_ = value;
        }
        onChanged();
      } else {
        if (bodyCase_ == 3) {
          payloadBuilder_.mergeFrom(value);
        }
        payloadBuilder_.setMessage(value);
      }
      bodyCase_ = 3;
      return this;
    }
    /** <code>.com.ververica.statefun.flink.core.Payload payload = 3;</code> */
    public Builder clearPayload() {
      if (payloadBuilder_ == null) {
        if (bodyCase_ == 3) {
          bodyCase_ = 0;
          body_ = null;
          onChanged();
        }
      } else {
        if (bodyCase_ == 3) {
          bodyCase_ = 0;
          body_ = null;
        }
        payloadBuilder_.clear();
      }
      return this;
    }
    /** <code>.com.ververica.statefun.flink.core.Payload payload = 3;</code> */
    public com.ververica.statefun.flink.core.generated.Payload.Builder getPayloadBuilder() {
      return getPayloadFieldBuilder().getBuilder();
    }
    /** <code>.com.ververica.statefun.flink.core.Payload payload = 3;</code> */
    public com.ververica.statefun.flink.core.generated.PayloadOrBuilder getPayloadOrBuilder() {
      if ((bodyCase_ == 3) && (payloadBuilder_ != null)) {
        return payloadBuilder_.getMessageOrBuilder();
      } else {
        if (bodyCase_ == 3) {
          return (com.ververica.statefun.flink.core.generated.Payload) body_;
        }
        return com.ververica.statefun.flink.core.generated.Payload.getDefaultInstance();
      }
    }
    /** <code>.com.ververica.statefun.flink.core.Payload payload = 3;</code> */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.ververica.statefun.flink.core.generated.Payload,
            com.ververica.statefun.flink.core.generated.Payload.Builder,
            com.ververica.statefun.flink.core.generated.PayloadOrBuilder>
        getPayloadFieldBuilder() {
      if (payloadBuilder_ == null) {
        if (!(bodyCase_ == 3)) {
          body_ = com.ververica.statefun.flink.core.generated.Payload.getDefaultInstance();
        }
        payloadBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.ververica.statefun.flink.core.generated.Payload,
                com.ververica.statefun.flink.core.generated.Payload.Builder,
                com.ververica.statefun.flink.core.generated.PayloadOrBuilder>(
                (com.ververica.statefun.flink.core.generated.Payload) body_,
                getParentForChildren(),
                isClean());
        body_ = null;
      }
      bodyCase_ = 3;
      onChanged();
      ;
      return payloadBuilder_;
    }

    @java.lang.Override
    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }

    // @@protoc_insertion_point(builder_scope:com.ververica.statefun.flink.core.Envelope)
  }

  // @@protoc_insertion_point(class_scope:com.ververica.statefun.flink.core.Envelope)
  private static final com.ververica.statefun.flink.core.generated.Envelope DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.ververica.statefun.flink.core.generated.Envelope();
  }

  public static com.ververica.statefun.flink.core.generated.Envelope getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<Envelope> PARSER =
      new com.google.protobuf.AbstractParser<Envelope>() {
        @java.lang.Override
        public Envelope parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          return new Envelope(input, extensionRegistry);
        }
      };

  public static com.google.protobuf.Parser<Envelope> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<Envelope> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public com.ververica.statefun.flink.core.generated.Envelope getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
